/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package contest.controller;

import contest.util.ErrorLog;
import contest.util.ResPathConstant;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 *
 * @author Admin
 */
public abstract class WebPage extends WebInit {

    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        try {
            response.setContentType("text/html;charset=UTF-8");

            this.loadRequest(request);
            this.processRequest(request, response);

  
        } catch (Exception ex) {
            ErrorLog.catchException(ResPathConstant.ERROR_LOG_TXT, (Exception) ex);
            forward("/error?code=" + getServletContext().getInitParameter("code-error-page"), request, response);
        }
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doGet(request, response);
    }
}
